package com.acme.bankapp.domain.bank;

import java.io.Serializable;

public class SavingAccount extends AbstractAccount implements Account,
		Serializable {
	
	private static final long serialVersionUID = 1L;
	private final static String s0 = "SavingAccount: balance = ";

	public SavingAccount(final int id, final double amount) {
		super(amount);
		this.id = id;
	}

	@Override
	public void deposit(final double amount) {
		setBalance(getBalance() + amount);
	}

	@Override
	public void withdraw(final double amount) {
		double balance = getBalance();
		if (balance >= amount) {
			setBalance(balance - amount);
		}
	}

	@Override
	public double maximumAmountToWithdraw() {
		return getBalance();
	}

	@Override
	public double getOverDraft() {
		return 0;
	}

	@Override
	public String toString() {
		return s0 + balance;
	}

}
